﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Pantry.Entity;
using Pantry.Business;
using System.Data;

namespace Pantry.Web.Users.Controls
{
    public partial class FundingDetail : System.Web.UI.UserControl
    {
        private readonly IFormatProvider _format = CultureInfo.CurrentCulture;
        private FunderBus _funderBus;
        private Funder _funder;

        protected void Page_Load(object sender, EventArgs e)
        {
            SelectFundingSourceData();
            ListContact.SendContactToPage += delegate(string contact)
                                                 {
                                                     var contacts = contact.Split('$');
                                                     HiddenFieldFundingContactDetail.Value = contacts[0];
                                                     TextBoxFundingContactDetail.Text = contacts[1];
                                                 };
        }

        /// <summary>
        /// Selects the funding source data.
        /// </summary>
        private void SelectFundingSourceData()
        {
            _funderBus = new FunderBus();
            DropDownListFundingSource.DataSource = _funderBus.SelectFundingSource();
            DropDownListFundingSource.DataTextField = "Name";
            DropDownListFundingSource.DataValueField = "ID";
            DropDownListFundingSource.DataBind();
        }

        protected void CheckBoxFundingContonuationNeededChanged(object sender, EventArgs e)
        {
            TextBoxFundingContinuationAmount.Enabled = CheckBoxFundingContonuationNeeded.Checked;
            TextBoxFundingContinuationDetails.Enabled = CheckBoxFundingContonuationNeeded.Checked;
        }

        protected void CheckBoxFundingDraisingCompleteChanged(object sender, EventArgs e)
        {
            TextBoxFundraisingCompledtedDate.Enabled = CheckBoxFundingDraisingComplete.Checked;
        }
        protected void ButtonSaveClick(object sender, EventArgs e)
        {
            
        }
        protected void ButtonBackClick(object sendeer, EventArgs e)
        {
            
        }
        protected void ButtonMarkInActiveClick(object sender, EventArgs eventArgs)
        {
            
        }
    }
}